import axios from 'axios'
import {BASEURL} from './config'
import { Message } from 'element-ui'
export function require(config){
    const instance=axios.create({
        baseURL :BASEURL,
        timeout:50000,
        headers: {
        'gym-token': localStorage.getItem('gymToken'),    
        },
    })
    instance.interceptors.response.use(
    response => {
        return response;
    },
    error => {
        // 处理错误
        Message({message: error.message, type:'error'},)
        // this.$message.error(error)
        // 返回自定义的错误信息或进行其他操作
        return Promise.reject({ message: '发生错误' });
    }
    )
    return instance(config)    
}

